package nl.fonfolio.view {
	import nl.fonfolio.controller.Controller;	
	import nl.fonfolio.model.Model;	
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	import nl.fonfolio.core.Fonfolio;
	
	import flash.display.Loader;
	import flash.net.URLRequest;	

	/**
	 * @author Paul
	 */
	public class ProjectThumb extends Sprite {
		private var fonfolio : Fonfolio;
		private var model : Model;
		private var controller : Controller;
		private var settings : Object;

		public function ProjectThumb(fonfolio : Fonfolio, model : Model, controller : Controller, settings:Object) {
			this.settings = settings;
			this.controller = controller;
			this.model = model;
			this.fonfolio = fonfolio;
			//trace("projectthumb constructor");
			this.addEventListener(MouseEvent.CLICK, onClick);
			
			var loader:Loader = new Loader();
            var request:URLRequest = new URLRequest(settings.image);
            loader.load(request);

            addChild(loader);
			
			
		}
		
		private function onClick(event : MouseEvent) : void {
			this.fonfolio.openProject(settings.projectId);
		}
	}
}
